//Set working directory and import data file
cd "/Users/gabriellelevy/OneDrive - Dartmouth College/Replication Files/Narang - Battle Death Model"
clear
import excel using levy_narang.xlsx, firstrow 

xtset warnumber year 

//This is basically the same model as Narang's, except battle deaths has moved from being an independent variable to a dependent variable. 
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests 

//NSTAR SUBSET ANALYSIS (data for Table C3)
destring epr_nstar, replace
sum epr_nstar, d
kdensity epr_nstar

cumul epr_nstar, gen(nstar_pctl) equal

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl<0.4 & nstar_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl >0.4 & nstar_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl<0.5 & nstar_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl >0.5 & nstar_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl<0.6 & nstar_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl >0.6 & nstar_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl<0.7 & nstar_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl >0.7 & nstar_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl<0.8 & nstar_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if nstar_pctl >0.8 & nstar_pctl!=.


//ETHNIC WAR SUBSET ANALYSIS (data for Table C3)
destring ethnic_war, replace

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests // original

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if ethnic_war==0

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if ethnic_war==1


//SUBSET ANALYSES FOR ADDITIONAL ETHNIC DIVIDES VARIABLES (exclpop, discrimpop, hief)
//exclpop (data for Table C4)
destring epr_exclpop, replace
sum epr_exclpop, d
kdensity epr_exclpop

cumul epr_exclpop, gen(exclpop_pctl) equal

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl<0.4 & exclpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl >0.4 & exclpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl<0.5 & exclpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl >0.5 & exclpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl<0.6 & exclpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl >0.6 & exclpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl<0.7 & exclpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl >0.7 & exclpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl<0.8 & exclpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if exclpop_pctl >0.8 & exclpop_pctl!=.

//discrimpop (data for Table C5)
destring epr_discrimpop, replace
sum epr_discrimpop, d
kdensity epr_discrimpop

cumul epr_discrimpop, gen(discrimpop_pctl) equal

//xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl<0.4 & discrimpop_pctl!=. //insufficient data
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl >0.4 & discrimpop_pctl!=.

//xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl<0.5 & discrimpop_pctl!=. //insufficient data
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl >0.5 & discrimpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl<0.6 & discrimpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl >0.6 & discrimpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl<0.7 & discrimpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl >0.7 & discrimpop_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl<0.8 & discrimpop_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if discrimpop_pctl >0.8 & discrimpop_pctl!=.

//hief (data for Table C6)
destring hief_ef, replace
sum hief_ef, d
kdensity hief_ef

cumul hief_ef, gen(hief_pctl) equal

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl<0.4 & hief_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl>0.4 & hief_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl<0.5 & hief_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl>0.5 & hief_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl<0.6 & hief_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl>0.6 & hief_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl<0.7 & hief_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl>0.7 & hief_pctl!=.

xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl<0.8 & hief_pctl!=.
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests if hief_pctl>0.8 & hief_pctl!=.


//INTERACTION ANALYSES
//Table C1: Narang Battle Deaths – Ethnic Divides Interaction Analysis
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests //original
outreg2 using tableC1.doc, replace ctitle(Original)
//nstar
gen nstar_x_aid=epr_nstar*L.aidlog
kdensity nstar_x_aid
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests nstar_x_aid epr_nstar
outreg2 using tableC1.doc, append ctitle(Nstar)
//ethnic war
gen ethnic_war_x_aid=ethnic_war*L.aidlog
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests ethnic_war_x_aid ethnic_war
outreg2 using tableC1.doc, append ctitle(Ethnic War)

//Table C2: Narang Battle Deaths – Ethnic Divides Interaction Analysis (full)
//original
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests //original
outreg2 using tableC2.doc, replace ctitle(Original)
//ethnic war
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests ethnic_war_x_aid ethnic_war
outreg2 using tableC2.doc, append ctitle(Ethnic War)
//nstar
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests nstar_x_aid epr_nstar
outreg2 using tableC2.doc, append ctitle(Nstar)
//other variables
//exclpop
gen exclpop_x_aid=epr_exclpop*L.aidlog
kdensity exclpop_x_aid
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests exclpop_x_aid epr_exclpop
outreg2 using tableC2.doc, append ctitle(Exclpop)
//discrimpop
gen discrimpop_x_aid=epr_discrimpop*L.aidlog
kdensity discrimpop_x_aid
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests  discrimpop_x_aid epr_discrimpop 
outreg2 using tableC2.doc, append ctitle(Discrimpop)
//hief
gen hief_x_aid=hief_ef*L.aidlog
kdensity hief_x_aid
xtreg bdeadbest L.aidlog logpop gdppc polity2 diamonds drugs resources guarantee mountains forests  hief_x_aid hief_ef 
outreg2 using tableC2.doc, append ctitle(Hief)



